<!--
 * @Description: 
 * @Author: mxy
 * @Date: 2022-11-12 21:16:31
 * @LastEditors: mxy
 * @LastEditTime: 2022-11-12 21:21:16
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let p = new Promise((resolve, reject) => {
            setTimeout(() => {
                if (Math.random() * 1000 > 500) {
                    resolve('赚钱了')
                } else {
                    reject('我不配')
                }
            }, 500)
        })
        p.then(success => {
            console.log(success);
        }).catch(error => {
            console.log(error);
        })
    </script>
</body>

</html>